﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace InstituteManager.adm
{
    public partial class Admin : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Username"] == null)
                Response.Redirect("login.aspx?redirect=" + Path.GetFileName(Request.Path));

            lblHello.Text = "<b>" + Session["Username"] + "</b> ";
            switch (Session["Permission"].ToString())
            {
                case "0":
                    lblHello.Text += "Student";
                    pnlStudent.Visible = true;
                    break;
                case "1":
                    lblHello.Text += "Administrator";
                    pnlAdminMenu.Visible = true;
                    break;
                case "2":
                    lblHello.Text += "Manager";
                    pnlManager.Visible = true;
                    break;
                case "3":
                    lblHello.Text += "Staff";
                    pnlStaff.Visible = true;
                    break;
            }
        }

        protected void lbtLogOff_Click(object sender, EventArgs e)
        {
            Session["Username"] = null;
            Session["Permission"] = null;
            Response.Redirect("login.aspx");
        }
    }
}